JUnit 5 clear and quick by Gabriele Falace

JUnit 5 clear and quick by Gabriele Falace

Author:Gabriele Falace [Falace, Gabriele]
Language: eng
Format: azw3
Published: 2017-10-17T04:00:00+00:00


class WordProcessor {

String capitalize(String word) {

String firstCharUppercase = String.valueOf(word.charAt(0).toUpperCase());

return firstCharUppercase + word.substring(1);

}

}

The corresponding test, will look like this:

class WordProcessorTest {

private WordProcessor wordProcessor = new WordProcessor();

@TestFactory

Stream<DynamicTest> generateTestsWithMap() {

Map<String, String> outputMap = new HashMap<>();

outputMap.put(“hi”, “Hi”);

outputMap.put(“dog”, “Dog”);

outputMap.put(“woof!”, “Woof!”);



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.